<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Colormaps and Colors</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK 2 Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk-Pixbufs.html" title="Pixbufs">
<link rel="next" href="gdk-Visuals.html" title="Visuals">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Pixbufs.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK 2 Reference Manual</th>
<td><a accesskey="n" href="gdk-Visuals.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-Colormaps-and-Colors.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk-Colormaps-and-Colors.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk-Colormaps-and-Colors"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-Colormaps-and-Colors.top_of_page"></a>Colormaps and Colors</span></h2>
<p>Colormaps and Colors — Manipulation of colors and colormaps</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-Colormaps-and-Colors.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk/gdk.h&gt;

                    <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor">GdkColor</a>;
                    <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap">GdkColormap</a>;
<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="returnvalue">GdkColormap</span></a> *       <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-new" title="gdk_colormap_new ()">gdk_colormap_new</a>                    (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a> *visual</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> allocate</code></em>);
<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="returnvalue">GdkColormap</span></a> *       <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-ref" title="gdk_colormap_ref ()">gdk_colormap_ref</a>                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *cmap</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-unref" title="gdk_colormap_unref ()">gdk_colormap_unref</a>                  (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *cmap</code></em>);
<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="returnvalue">GdkColormap</span></a> *       <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system" title="gdk_colormap_get_system ()">gdk_colormap_get_system</a>             (<em class="parameter"><code><span class="type">void</span></code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system-size" title="gdk_colormap_get_system_size ()">gdk_colormap_get_system_size</a>        (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-change" title="gdk_colormap_change ()">gdk_colormap_change</a>                 (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> ncolors</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors" title="gdk_colormap_alloc_colors ()">gdk_colormap_alloc_colors</a>           (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> writeable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> best_match</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> *success</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color" title="gdk_colormap_alloc_color ()">gdk_colormap_alloc_color</a>            (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> writeable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> best_match</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-free-colors" title="gdk_colormap_free_colors ()">gdk_colormap_free_colors</a>            (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_colors</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-query-color" title="gdk_colormap_query_color ()">gdk_colormap_query_color</a>            (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> pixel</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *result</code></em>);
<a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-visual" title="gdk_colormap_get_visual ()">gdk_colormap_get_visual</a>             (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>);
<a class="link" href="GdkScreen.html" title="GdkScreen"><span class="returnvalue">GdkScreen</span></a> *         <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-screen" title="gdk_colormap_get_screen ()">gdk_colormap_get_screen</a>             (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *cmap</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colors-store" title="gdk_colors_store ()">gdk_colors_store</a>                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> ncolors</code></em>);
<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="returnvalue">GdkColor</span></a> *          <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-copy" title="gdk_color_copy ()">gdk_color_copy</a>                      (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-free" title="gdk_color_free ()">gdk_color_free</a>                      (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colors-alloc" title="gdk_colors_alloc ()">gdk_colors_alloc</a>                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> contiguous</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> *planes</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> nplanes</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> *pixels</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> npixels</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colors-free" title="gdk_colors_free ()">gdk_colors_free</a>                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> *pixels</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> npixels</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> planes</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-white" title="gdk_color_white ()">gdk_color_white</a>                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-black" title="gdk_color_black ()">gdk_color_black</a>                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-parse" title="gdk_color_parse ()">gdk_color_parse</a>                     (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *spec</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-alloc" title="gdk_color_alloc ()">gdk_color_alloc</a>                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-change" title="gdk_color_change ()">gdk_color_change</a>                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-equal" title="gdk_color_equal ()">gdk_color_equal</a>                     (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colora</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colorb</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-hash" title="gdk_color_hash ()">gdk_color_hash</a>                      (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colora</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-to-string" title="gdk_color_to_string ()">gdk_color_to_string</a>                 (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk-Colormaps-and-Colors.description"></a><h2>Description</h2>
<p>
These functions are used to modify colormaps.
A colormap is an object that contains the mapping
between the color values stored in memory and
the RGB values that are used to display color
values. In general, colormaps only contain
significant information for pseudo-color visuals,
but even for other visual types, a colormap object
is required in some circumstances.
</p>
<p>
There are a couple of special colormaps that can
be retrieved. The system colormap (retrieved
with <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-system" title="gdk_colormap_get_system ()"><code class="function">gdk_colormap_get_system()</code></a>) is the default
colormap of the system. If you are using GdkRGB,
there is another colormap that is important - the
colormap in which GdkRGB works, retrieved with
<a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-colormap" title="gdk_rgb_get_colormap ()"><code class="function">gdk_rgb_get_colormap()</code></a>. However, when using GdkRGB,
it is not generally necessary to allocate colors
directly.
</p>
<p>
In previous revisions of this interface, a number
of functions that take a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> parameter
were replaced with functions whose names began
with "gdk_colormap_". This process will probably
be extended somewhat in the future -
<a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-white" title="gdk_color_white ()"><code class="function">gdk_color_white()</code></a>, <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-black" title="gdk_color_black ()"><code class="function">gdk_color_black()</code></a>, and
<a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-change" title="gdk_color_change ()"><code class="function">gdk_color_change()</code></a> will probably become aliases.
</p>
</div>
<div class="refsect1">
<a name="gdk-Colormaps-and-Colors.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdkColor"></a><h3>GdkColor</h3>
<pre class="programlisting">typedef struct {
  guint32 pixel;
  guint16 red;
  guint16 green;
  guint16 blue;
} GdkColor;
</pre>
<p>
The <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> structure is used to describe an
allocated or unallocated color.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> <em class="structfield"><code><a name="GdkColor.pixel"></a>pixel</code></em>;</span></p></td>
<td>For allocated colors, the value used to
draw this color on the screen.</td>
</tr>
<tr>
<td><p><span class="term"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> <em class="structfield"><code><a name="GdkColor.red"></a>red</code></em>;</span></p></td>
<td>The red component of the color. This is
a value between 0 and 65535, with 65535 indicating
full intensitiy.</td>
</tr>
<tr>
<td><p><span class="term"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> <em class="structfield"><code><a name="GdkColor.green"></a>green</code></em>;</span></p></td>
<td>The green component of the color.</td>
</tr>
<tr>
<td><p><span class="term"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"><span class="type">guint16</span></a> <em class="structfield"><code><a name="GdkColor.blue"></a>blue</code></em>;</span></p></td>
<td>The blue component of the color.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkColormap"></a><h3>GdkColormap</h3>
<pre class="programlisting">typedef struct {
  gint      GSEAL (size);
  GdkColor *GSEAL (colors);
} GdkColormap;
</pre>
<p>
The colormap structure contains the following public fields.
</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-new"></a><h3>gdk_colormap_new ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="returnvalue">GdkColormap</span></a> *       gdk_colormap_new                    (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a> *visual</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> allocate</code></em>);</pre>
<p>
Creates a new colormap for the given visual.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>visual</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>allocate</code></em> :</span></p></td>
<td>if <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the newly created colormap will be
a private colormap, and all colors in it will be
allocated for the applications use.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-ref"></a><h3>gdk_colormap_ref ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="returnvalue">GdkColormap</span></a> *       gdk_colormap_ref                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *cmap</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_ref</code> has been deprecated since version 2.0 and should not be used in newly-written code. Use <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-ref"><code class="function">g_object_ref()</code></a> instead.</p>
</div>
<p>
Deprecated function; use <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-ref"><code class="function">g_object_ref()</code></a> instead.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the colormap</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-unref"></a><h3>gdk_colormap_unref ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_colormap_unref                  (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *cmap</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_unref</code> has been deprecated since version 2.0 and should not be used in newly-written code. Use <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> instead.</p>
</div>
<p>
Deprecated function; use <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> instead.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>cmap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-get-system"></a><h3>gdk_colormap_get_system ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="returnvalue">GdkColormap</span></a> *       gdk_colormap_get_system             (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Gets the system's default colormap for the default screen. (See
<code class="function">gdk_colormap_get_system_for_screen()</code>)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the default colormap.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-get-system-size"></a><h3>gdk_colormap_get_system_size ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_colormap_get_system_size        (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_get_system_size</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Returns the size of the system's default colormap.
(See the description of struct <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> for an
explanation of the size of a colormap.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the size of the system's default colormap.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-change"></a><h3>gdk_colormap_change ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_colormap_change                 (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> ncolors</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colormap_change</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Changes the value of the first <em class="parameter"><code>ncolors</code></em> in a private colormap
to match the values in the <em class="structfield"><code>colors</code></em>
array in the colormap. This function is obsolete and
should not be used. See <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-change" title="gdk_color_change ()"><code class="function">gdk_color_change()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ncolors</code></em> :</span></p></td>
<td>the number of colors to change.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-alloc-colors"></a><h3>gdk_colormap_alloc_colors ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_colormap_alloc_colors           (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> writeable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> best_match</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> *success</code></em>);</pre>
<p>
Allocates colors from a colormap.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>colors</code></em> :</span></p></td>
<td>The color values to allocate. On return, the pixel
values for allocated colors will be filled in.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_colors</code></em> :</span></p></td>
<td>The number of colors in <em class="parameter"><code>colors</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>writeable</code></em> :</span></p></td>
<td>If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the colors are allocated writeable
(their values can later be changed using <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-change" title="gdk_color_change ()"><code class="function">gdk_color_change()</code></a>).
Writeable colors cannot be shared between applications.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>best_match</code></em> :</span></p></td>
<td>If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, GDK will attempt to do matching against
existing colors if the colors cannot be allocated as requested.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>success</code></em> :</span></p></td>
<td>An array of length <em class="parameter"><code>ncolors</code></em>. On return, this
indicates whether the corresponding color in <em class="parameter"><code>colors</code></em> was
successfully allocated or not.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The number of colors that were not successfully
allocated.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-alloc-color"></a><h3>gdk_colormap_alloc_color ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_colormap_alloc_color            (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> writeable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> best_match</code></em>);</pre>
<p>
Allocates a single color from a colormap.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>the color to allocate. On return the
<em class="structfield"><code>pixel</code></em> field will be
filled in if allocation succeeds.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>writeable</code></em> :</span></p></td>
<td>If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the color is allocated writeable
(their values can later be changed using <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-change" title="gdk_color_change ()"><code class="function">gdk_color_change()</code></a>).
Writeable colors cannot be shared between applications.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>best_match</code></em> :</span></p></td>
<td>If <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, GDK will attempt to do matching against
existing colors if the color cannot be allocated as requested.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the allocation succeeded.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-free-colors"></a><h3>gdk_colormap_free_colors ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_colormap_free_colors            (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> n_colors</code></em>);</pre>
<p>
Frees previously allocated colors.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>colors</code></em> :</span></p></td>
<td>the colors to free.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_colors</code></em> :</span></p></td>
<td>the number of colors in <em class="parameter"><code>colors</code></em>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-query-color"></a><h3>gdk_colormap_query_color ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_colormap_query_color            (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> pixel</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *result</code></em>);</pre>
<p>
Locates the RGB color in <em class="parameter"><code>colormap</code></em> corresponding to the given
hardware pixel <em class="parameter"><code>pixel</code></em>. <em class="parameter"><code>pixel</code></em> must be a valid pixel in the
colormap; it's a programmer error to call this function with a
pixel which is not in the colormap. Hardware pixels are normally
obtained from <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors" title="gdk_colormap_alloc_colors ()"><code class="function">gdk_colormap_alloc_colors()</code></a>, or from a <a class="link" href="gdk-Images.html#GdkImage" title="GdkImage"><span class="type">GdkImage</span></a>. (A
<a class="link" href="gdk-Images.html#GdkImage" title="GdkImage"><span class="type">GdkImage</span></a> contains image data in hardware format, a <a href="http://library.gnome.org/devel/gdk-pixbuf/unstable/gdk-pixbuf-The-GdkPixbuf-Structure.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a>
contains image data in a canonical 24-bit RGB format.)
</p>
<p>
This function is rarely useful; it's used for example to
implement the eyedropper feature in <a href="http://library.gnome.org/devel/gtk/GtkColorSelection.html"><span class="type">GtkColorSelection</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixel</code></em> :</span></p></td>
<td>pixel value in hardware display format</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
<td>
<a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> with red, green, blue fields initialized</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-get-visual"></a><h3>gdk_colormap_get_visual ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         gdk_colormap_get_visual             (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>);</pre>
<p>
Returns the visual for which a given colormap was created.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the visual of the colormap.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colormap-get-screen"></a><h3>gdk_colormap_get_screen ()</h3>
<pre class="programlisting"><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="returnvalue">GdkScreen</span></a> *         gdk_colormap_get_screen             (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *cmap</code></em>);</pre>
<p>
Gets the screen for which this colormap was created.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the screen for which this colormap was created.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colors-store"></a><h3>gdk_colors_store ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_colors_store                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colors</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> ncolors</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colors_store</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Changes the value of the first <em class="parameter"><code>ncolors</code></em> colors in
a private colormap. This function is obsolete and
should not be used. See <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-change" title="gdk_color_change ()"><code class="function">gdk_color_change()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>colors</code></em> :</span></p></td>
<td>the new color values.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ncolors</code></em> :</span></p></td>
<td>the number of colors to change.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-copy"></a><h3>gdk_color_copy ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="returnvalue">GdkColor</span></a> *          gdk_color_copy                      (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<p>
Makes a copy of a color structure. The result
must be freed using <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-free" title="gdk_color_free ()"><code class="function">gdk_color_free()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a copy of <em class="parameter"><code>color</code></em>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-free"></a><h3>gdk_color_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_color_free                      (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<p>
Frees a color structure created with 
<a class="link" href="gdk-Colormaps-and-Colors.html#gdk-color-copy" title="gdk_color_copy ()"><code class="function">gdk_color_copy()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colors-alloc"></a><h3>gdk_colors_alloc ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_colors_alloc                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> contiguous</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> *planes</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> nplanes</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> *pixels</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> npixels</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colors_alloc</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Allocates colors from a colormap. This function
is obsolete. See <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors" title="gdk_colormap_alloc_colors ()"><code class="function">gdk_colormap_alloc_colors()</code></a>.
For full documentation of the fields, see 
the Xlib documentation for <code class="function"><code class="function">XAllocColorCells()</code></code>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>contiguous</code></em> :</span></p></td>
<td>if <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, the colors should be allocated
in contiguous color cells.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>planes</code></em> :</span></p></td>
<td>an array in which to store the plane masks.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>nplanes</code></em> :</span></p></td>
<td>the number of planes to allocate. (Or zero,
to indicate that the color allocation should not be planar.)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixels</code></em> :</span></p></td>
<td>an array into which to store allocated pixel values.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>npixels</code></em> :</span></p></td>
<td>the number of pixels in each plane to allocate.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the allocation was successful</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-colors-free"></a><h3>gdk_colors_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_colors_free                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> *pixels</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> npixels</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gulong"><span class="type">gulong</span></a> planes</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_colors_free</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Frees colors allocated with <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colors-alloc" title="gdk_colors_alloc ()"><code class="function">gdk_colors_alloc()</code></a>. This
function is obsolete. See <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-free-colors" title="gdk_colormap_free_colors ()"><code class="function">gdk_colormap_free_colors()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixels</code></em> :</span></p></td>
<td>the pixel values of the colors to free.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>npixels</code></em> :</span></p></td>
<td>the number of values in <em class="parameter"><code>pixels</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>planes</code></em> :</span></p></td>
<td>the plane masks for all planes to free, OR'd together.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-white"></a><h3>gdk_color_white ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_color_white                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_white</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Returns the white color for a given colormap. The resulting
value has already allocated been allocated.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>the location to store the color.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the allocation succeeded.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-black"></a><h3>gdk_color_black ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_color_black                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_black</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Returns the black color for a given colormap. The resulting
value has already been allocated.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>the location to store the color.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the allocation succeeded.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-parse"></a><h3>gdk_color_parse ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_color_parse                     (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *spec</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<p>
Parses a textual specification of a color and fill in the
<em class="structfield"><code>red</code></em>, <em class="structfield"><code>green</code></em>,
and <em class="structfield"><code>blue</code></em> fields of a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>
structure. The color is <span class="emphasis"><em>not</em></span> allocated, you
must call <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color" title="gdk_colormap_alloc_color ()"><code class="function">gdk_colormap_alloc_color()</code></a> yourself. The string can
either one of a large set of standard names. (Taken from the X11
<code class="filename">rgb.txt</code> file), or it can be a hex value in the
form '#rgb' '#rrggbb' '#rrrgggbbb' or
'#rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the
red, green, and blue components of the color, respectively. (White
in the four forms is '#fff' '#ffffff' '#fffffffff' and
'#ffffffffffff')
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>spec</code></em> :</span></p></td>
<td>the string specifying the color.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>the <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> to fill in. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the parsing succeeded.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-alloc"></a><h3>gdk_color_alloc ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_color_alloc                     (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_alloc</code> has been deprecated since version 2.2 and should not be used in newly-written code. Use <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color" title="gdk_colormap_alloc_color ()"><code class="function">gdk_colormap_alloc_color()</code></a> instead.</p>
</div>
<p>
Allocates a single color from a colormap.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>The color to allocate. On return, the
<em class="structfield"><code>pixel</code></em> field will be filled in.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the allocation succeeded.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-change"></a><h3>gdk_color_change ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_color_change                    (<em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a> *colormap</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_color_change</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Changes the value of a color that has already
been allocated. If <em class="parameter"><code>colormap</code></em> is not a private
colormap, then the color must have been allocated
using <a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-colors" title="gdk_colormap_alloc_colors ()"><code class="function">gdk_colormap_alloc_colors()</code></a> with the 
<em class="parameter"><code>writeable</code></em> set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colormap</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>, with the color to change
in the <em class="structfield"><code>pixel</code></em> field,
and the new value in the remaining fields.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the color was successfully changed.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-equal"></a><h3>gdk_color_equal ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gdk_color_equal                     (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colora</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colorb</code></em>);</pre>
<p>
Compares two colors.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colora</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>colorb</code></em> :</span></p></td>
<td>another <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the two colors compare equal</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-hash"></a><h3>gdk_color_hash ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               gdk_color_hash                      (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *colora</code></em>);</pre>
<p>
A hash function suitable for using for a hash
table that stores <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>'s.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>colora</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The hash function applied to <em class="parameter"><code>colora</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-color-to-string"></a><h3>gdk_color_to_string ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *             gdk_color_to_string                 (<em class="parameter"><code>const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> *color</code></em>);</pre>
<p>
Returns a textual specification of <em class="parameter"><code>color</code></em> in the hexadecimal form
<code class="literal">#rrrrggggbbbb</code>, where <code class="literal">r</code>,
<code class="literal">g</code> and <code class="literal">b</code> are hex digits
representing the red, green and blue components respectively.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly-allocated text string</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.12</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>